import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { FactoryBaseService } from './factoryBase.service';
import { CreateFactoryBaseDto } from './dto/create-factoryBase.dto';
import { UpdateFactoryBaseDto } from './dto/update-factoryBase.dto';
import { ApiBearerAuth, ApiBody, ApiTags } from '@nestjs/swagger';
@ApiTags('工厂管理')
@ApiBearerAuth()
@Controller('/api/factoryBase')
export class FactoryBaseController {
  constructor(private readonly factoryService: FactoryBaseService) {}

  @ApiBody({
    schema: {
      type: 'object',
      properties: {
        factoryName: {
          type: 'string',
          example: 'test22222222',
          description: '工厂名',
        },
      },
    },
  })
  @Post('/create')
  create(@Body() createFactoryDto: CreateFactoryBaseDto) {
    return this.factoryService.create(createFactoryDto);
  }

  @Get()
  findAll() {
    return this.factoryService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.factoryService.findOne(+id);
  }

  @Patch(':id')
  update(
    @Param('id') id: string,
    @Body() updateFactoryDto: UpdateFactoryBaseDto,
  ) {
    return this.factoryService.update(+id, updateFactoryDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.factoryService.remove(+id);
  }
}
